require("../../../../@babel/runtime/helpers/Objectvalues"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/home/components/bussiness-coupons/index" ], {
    "4caa": function(e, t, n) {
        n.d(t, "b", function() {
            return r;
        }), n.d(t, "c", function() {
            return o;
        }), n.d(t, "a", function() {});
        var r = function() {
            this.$createElement;
            this._self._c;
        }, o = [];
    },
    "73d5": function(e, t, n) {
        var r = n("7d22");
        n.n(r).a;
    },
    7430: function(e, t, n) {
        var r = n("4ea4").default;
        Object.defineProperty(t, "__esModule", {
            value: !0
        }), t.default = void 0;
        var o = r(n("a34a")), a = r(n("448a")), u = r(n("c973")), s = n("fd0e"), i = n("8f93"), c = n("665c"), l = r(n("0613")), d = n("05dc"), f = n("6b87"), p = n("2639"), _ = r(n("b7c7")), v = n("164e"), b = n("b70e"), m = {
            setup: function(e, t) {
                var n = "url(".concat(f.Images.rider.top, "), url(").concat(f.Images.rider.bottom, ")"), r = "url(".concat(f.Images.cold.top, "), url(").concat(f.Images.cold.bottom, ")"), m = (0, 
                c.useGetters)(), g = m.isMotorcycle, h = m.isRefrigeratedService, y = t.emit;
                (0, s.onBeforeMount)(function() {
                    y("loaded", {
                        tryOpen: P
                    });
                });
                var w = (0, c.useGetters)().isLogined, x = (0, s.ref)(!1), C = (0, s.reactive)({
                    isDataQueried: !1,
                    isShow: !1,
                    couponList: [],
                    modalResolve: null,
                    isCold: !1
                }), k = (0, s.computed)(function() {
                    var e = 0, t = 0;
                    return C.couponList.forEach(function(n) {
                        1 === n.business_type ? e++ : 2 === n.business_type && t++;
                    }), {
                        isSingle: 0 === t && 1 === e,
                        couponCount: e,
                        taskCount: t
                    };
                });
                (0, s.watch)(function() {
                    return w.value;
                }, function(e) {
                    e || (C.isShow && O("logout-close"), C.isDataQueried = !1, C.couponList = [], function(e) {
                        l.default.commit("setState", e);
                    }({
                        meetAgainCouponsDisplayed: !1
                    }));
                });
                var j = null;
                function P(e) {
                    return S.apply(this, arguments);
                }
                function S() {
                    return (S = (0, u.default)(o.default.mark(function e(t) {
                        var n, r, a, u, s, i, c, d, f, b, m, h, y;
                        return o.default.wrap(function(e) {
                            for (;;) switch (e.prev = e.next) {
                              case 0:
                                if ((i = t.isCold) || g.value) {
                                    e.next = 3;
                                    break;
                                }
                                return e.abrupt("return");

                              case 3:
                                if (c = l.default.state.userVariables, null === (n = c.newer_user_type) || void 0 === n || !n.is_new_user) {
                                    e.next = 6;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 6:
                                if (!i || null !== (r = c.newer_user_type) && void 0 !== r && null !== (a = r.biz_new_user) && void 0 !== a && a.is_refrigerated) {
                                    e.next = 8;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 8:
                                if (i || null !== (u = c.newer_user_type) && void 0 !== u && null !== (s = u.biz_new_user) && void 0 !== s && s.is_ride) {
                                    e.next = 10;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 10:
                                return e.next = 12, (0, p.getCommonConfig)();

                              case 12:
                                if (d = e.sent, f = d.biz_benefit_config, 0 !== (b = void 0 === f ? {
                                    refrigerated_benefit_dialog_days: 6,
                                    rider_benefit_dialog_days: 6
                                } : f).rider_benefit_dialog_days || i) {
                                    e.next = 17;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 17:
                                if (0 !== b.refrigerated_benefit_dialog_days || !i) {
                                    e.next = 19;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 19:
                                return e.next = 21, _.default.get("".concat(v.BusinessCouponPopup.coldChain, "-").concat(l.default.state.userInfo.userFid));

                              case 21:
                                return m = e.sent, e.next = 24, _.default.get("".concat(v.BusinessCouponPopup.rider, "-").concat(l.default.state.userInfo.userFid));

                              case 24:
                                if (h = e.sent, !(i && m > Date.now())) {
                                    e.next = 27;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 27:
                                if (i || !(h > Date.now())) {
                                    e.next = 29;
                                    break;
                                }
                                return e.abrupt("return", Promise.reject());

                              case 29:
                                return j = l.default.getters.selectedVehicle.order_vehicle_id, C.isCold = i, e.next = 33, 
                                B();

                              case 33:
                                return y = e.sent, e.abrupt("return", new Promise(function(e) {
                                    C.modalResolve = e, y.list.length && j === l.default.getters.selectedVehicle.order_vehicle_id ? (C.couponList = y.list, 
                                    C.isShow = !0, z()) : O("no-data");
                                }));

                              case 35:
                              case "end":
                                return e.stop();
                            }
                        }, e);
                    }))).apply(this, arguments);
                }
                function B() {
                    return I.apply(this, arguments);
                }
                function I() {
                    return (I = (0, u.default)(o.default.mark(function e() {
                        var t, n, r, u, s, c;
                        return o.default.wrap(function(e) {
                            for (;;) switch (e.prev = e.next) {
                              case 0:
                                return t = {
                                    list: []
                                }, e.prev = 1, s = {
                                    city_id: (null === (n = l.default.getters.startAddress) || void 0 === n ? void 0 : n.city_id) || 0,
                                    order_vehicle_id: l.default.getters.selectedVehicle.order_vehicle_id,
                                    vehicle_attr: l.default.getters.selectedVehicle.vehicle_attr,
                                    biz_type: C.isCold ? 3 : 2
                                }, e.next = 5, (0, b.usePreload)("getBizBenefit", function() {
                                    return (0, i.getBizBenefit)(s);
                                }, [].concat((0, a.default)(Object.values(s)), [ l.default.state.userInfo.token ]));

                              case 5:
                                0 === (c = e.sent).ret && null !== (r = c.data) && void 0 !== r && null !== (u = r.list) && void 0 !== u && u.length && (t.list = c.data.list), 
                                e.next = 12;
                                break;

                              case 9:
                                e.prev = 9, e.t0 = e.catch(1), console.error(e.t0);

                              case 12:
                                return e.abrupt("return", t);

                              case 13:
                              case "end":
                                return e.stop();
                            }
                        }, e, null, [ [ 1, 9 ] ]);
                    }))).apply(this, arguments);
                }
                function O() {
                    var e, t, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "close";
                    if ("no-data" === n) return C.isShow = !1, void (null === (t = C.modalResolve) || void 0 === t || t.call(C, {
                        type: n
                    }));
                    x.value = !0, null === (e = C.modalResolve) || void 0 === e || e.call(C, {
                        type: n
                    }), setTimeout((0, u.default)(o.default.mark(function e() {
                        var t, n, r, a, u;
                        return o.default.wrap(function(e) {
                            for (;;) switch (e.prev = e.next) {
                              case 0:
                                return x.value = !1, C.isShow = !1, e.next = 4, (0, p.getCommonConfig)();

                              case 4:
                                t = e.sent, n = t.biz_benefit_config, r = void 0 === n ? {
                                    refrigerated_benefit_dialog_days: 6,
                                    rider_benefit_dialog_days: 6
                                } : n, C.isCold ? (a = r.refrigerated_benefit_dialog_days || 1, _.default.set("".concat(v.BusinessCouponPopup.coldChain, "-").concat(l.default.state.userInfo.userFid), Date.now() + 24 * (a - 1) * 60 * 60 * 1e3)) : (u = r.rider_benefit_dialog_days || 1, 
                                _.default.set("".concat(v.BusinessCouponPopup.rider, "-").concat(l.default.state.userInfo.userFid), Date.now() + 24 * (u - 1) * 60 * 60 * 1e3));

                              case 8:
                              case "end":
                                return e.stop();
                            }
                        }, e);
                    })), 300);
                }
                function z() {
                    var e = {
                        3: "大车",
                        4: "小车"
                    }, t = {
                        1: "立减券/满减券",
                        2: "折扣券",
                        3: "完单返积分",
                        4: "完单返券",
                        5: "完单返券",
                        8: "完单返现"
                    }, n = [], r = [];
                    C.couponList.forEach(function(o) {
                        n.push(e[o.business_line]), r.push(t[o.discount_type]);
                    }), (0, d.statistics)("homepage_group_pop_expo", {
                        frame_city: l.default.getters.commonStatisticsState.frame_city,
                        group_name: g.value ? "跑腿新客" : h.value ? "冷运新客" : "",
                        pop_type: k.value.isSingle ? "单权益" : "多权益样式",
                        coupon_type: g.value ? "跑腿" : h.value ? "冷运" : "",
                        rights_type: r.join(","),
                        coupon_cnt: k.value.couponCount,
                        user_task_cnt: k.value.taskCount
                    });
                }
                function D(e) {
                    (0, d.statistics)("homepage_group_pop_click", {
                        frame_city: l.default.getters.commonStatisticsState.frame_city,
                        group_name: g.value ? "跑腿新客" : h.value ? "冷运新客" : "",
                        module_name: e
                    });
                }
                return Object.assign({
                    Images: f.Images,
                    riderBG: n,
                    coldBG: r,
                    startFade: x,
                    animationTime: 300,
                    data: C,
                    singleObj: k,
                    handleConfirm: function() {
                        D("收下"), O();
                    },
                    handleClose: function() {
                        D("关闭"), O();
                    }
                }, {
                    tryOpen: P
                });
            }
        };
        m.components = Object.assign({
            CouponCard: function() {
                n.e("pages/home/components/bussiness-coupons/coupon-card").then(function() {
                    return resolve(n("f9d6"));
                }.bind(null, n)).catch(n.oe);
            }
        }, m.components);
        var g = m;
        t.default = g;
    },
    "7d22": function(e, t, n) {},
    a718: function(e, t, n) {
        n.r(t);
        var r = n("4caa"), o = n("f404");
        for (var a in o) [ "default" ].indexOf(a) < 0 && function(e) {
            n.d(t, e, function() {
                return o[e];
            });
        }(a);
        n("73d5");
        var u = n("f0c5"), s = Object(u.a)(o.default, r.b, r.c, !1, null, "4e651e64", null, !1, r.a, void 0);
        t.default = s.exports;
    },
    f404: function(e, t, n) {
        n.r(t);
        var r = n("7430"), o = n.n(r);
        for (var a in r) [ "default" ].indexOf(a) < 0 && function(e) {
            n.d(t, e, function() {
                return r[e];
            });
        }(a);
        t.default = o.a;
    }
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "pages/home/components/bussiness-coupons/index-create-component", {
    "pages/home/components/bussiness-coupons/index-create-component": function(e, t, n) {
        n("543d").createComponent(n("a718"));
    }
}, [ [ "pages/home/components/bussiness-coupons/index-create-component" ] ] ]);